<h1>TEXTES</h1>
<?php
$req = $bdd->query('SELECT * FROM categories_textes ORDER BY nom');
?><ul><?php
while ($donnees = $req->fetch())
{
	?><li><a href="index.php?page=textes&cat=<?php echo $donnees['id']; ?>"><?php echo $donnees['nom']; ?></a></li><?php
}
?></ul>

<?php
$req_cat = $bdd->query('SELECT * FROM categories_textes ORDER BY nom');
while ($donnees_cat = $req_cat->fetch())
{
	?><p><a href="index.php?page=textes&cat=<?php echo $donnees_cat['id']; ?>"><?php echo $donnees_cat['nom']; ?></a></p><?php
	$req = $bdd->prepare('SELECT * FROM chapitres  WHERE categorie=:id ORDER BY titre');
	$req->execute(array('id' => $donnees_cat['id']));
	?><ul><?php
	while ($donnees = $req->fetch())
	{
		?><li><a href="index.php?page=textes&ch=<?php echo $donnees['id']; ?>"><?php echo substr($donnees['titre'], 0, 20); ?></a>..</li><?php
	}
	?></ul>
	<?php
}
